#include "tst_infoqttest.h"
#include <stdexcept>

InfoQtTest::InfoQtTest() {}

InfoQtTest::~InfoQtTest() {}

void InfoQtTest::initTestCase() {}

void InfoQtTest::cleanupTestCase() {}

void InfoQtTest::test_case1() {
    // 基本验证
    QVERIFY(2 + 2 == 4);

    // 带消息的验证
    QVERIFY2(3 * 3 == 9, "乘法运算失败");

    // 比较测试
    QCOMPARE(sqrt(4.0), 2.0);

    // 浮点数模糊比较
    QVERIFY(qFuzzyCompare(1.0 / 3.0 * 3.0, 1.0));

    // 异常测试
    QVERIFY_EXCEPTION_THROWN(throw std::runtime_error("error"), std::runtime_error);

    // 性能测试
    QBENCHMARK {
        volatile int sum = 0;
        for (int i = 0; i < 1000; ++i) {
            sum += i;
        }
    }
}
//QTEST_APPLESS_MAIN(InfoQtTest)

#include "tst_infoqttest.moc"
